<?php 
	function get_captcha(){
		$ci = &get_instance();
		$ci->load->helper('captcha');
		$random = rand_string(5);//incrementalHash();
		$vals = array(
			'word'		=> $random,
			'img_path'	=> './captcha/',
			'img_url'	=> base_url('captcha/')."/",
			'font_path'	=> './captcha/fonts/OpenSans-CondLight-webfont.ttf',
			'img_width'	=> '250',
			'img_height' => 40,
			'expiration' => 7200
		);
		$cap = create_captcha($vals);
		$ci->session->set_userdata("info_captcha",$random);
		return $cap['image'];
	}
	function rand_string( $length ) {
		//$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
		$chars = "ABCDEFGHKMNPQRSTUVWXYZ123456789";
		$size = strlen( $chars );
		$str = '';
		for( $i = 0; $i < $length; $i++ ) {
		$str .= $chars[ rand( 0, $size - 1 ) ];
		 }
		return $str;
	}
?>